home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / prog / bozol2.arj / CALC.CMD < prev    next >
OS/2 REXX Batch file  |  1993-11-17  |  777b  |  19 lines

  1.         CASE "CALC","EVAL","WHAT"
  2.                 ' Build an expression to calculate by stringing together
  3.                 ' all pushed arguments that may constitute an arithmetic
  4.                 ' expression.  When we come to a non arithmetic symbol or
  5.                 ' bit of text, push it back and calculate what we have.
  6.                 A$=""
  7.                 DO
  8.                     B$=POPARG$
  9.                         IF VERIFY(B$,"01234567890 .+-/\*^()><=") THEN
  10.                             PUSHARG B$
  11.                                 EXIT LOOP
  12.                         END IF
  13.                 A$=A$+B$
  14.                 LOOP WHILE ArgPtr%>0
  15.                 PUSHARG STR$(CALC(A$))
  16.  
  17.     CASE "+","-","/","\","*","^","(",")",">","<","=","&"
  18.                 PUSHARG PRG$
  19.